package com.duheng.service.impl;

import com.duheng.domain.NormalUser;
import com.duheng.domain.User;
import com.duheng.mapper.NormalUserMapper;
import com.duheng.mapper.UserMapper;
import com.duheng.service.NormalUerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @PackageName: com.duheng.service.impl
 * @ClassName: NormalUserService
 * @Author: Misaka
 * @Date: 2020/2/23 20:19
 * @Description:
 */
@Service("normalUserService")
public class NormalUserServiceImpl implements NormalUerService {

    @Autowired
    private NormalUserMapper normalUserMapper;
    @Autowired
    private UserMapper userMapper;


    @Override
    public User login(NormalUser normalUser) {
        NormalUser byUsernameAndPassword = normalUserMapper.findByUsernameAndPassword(normalUser);
        if (byUsernameAndPassword != null) {
        return userMapper.findById(byUsernameAndPassword.getLid());
        }
        return null;
    }
}
